/* dig.h
 * The dig module contains functions for analyzing a map to determine
 * appropriate locations to dig dungeon elements such as rooms and
 * tunnels. They can then modify the map to insert these dungeon 
 * structures. All dig functions will extend the map as necessary.
 * To ensure correct operation of all functions in this module,
 * the map must not have been modified manually in between calls to
 * dig functions. dig_init must be called before any calls to any of
 * these functions is made for the first time.
 */
#ifndef DIG_H_
#define DIG_H_

#include "util/rect.h"
#include "layout.h"

// Call these at the beginning/end of all digging operations
void dig_init (Layout* l);
void dig_cleanup ();

/**
 * This function will attempt to place a rectangular shaped room of the
 * given dimensions in a free area of the map near the specified 
 * collection of preexisting rooms. The new room is then connected via
 * tunnels to all those preexisting rooms. Placing a room without any 
 * previous rooms (n_near == 0) will place that room close to the middle 
 * of the map on layer 0. Returns the ID of the new room, as chosen by
 * layout_add_room.
 */
int dig_room (int width, int height, int* near, int n_near);

#endif /* DIG_H_ */
